//package com.gfxy.modules.honour.controller;
//
//import com.alibaba.fastjson.JSONObject;
//import com.gfxy.modules.common.entity.MemberList;
//import com.gfxy.modules.common.service.IMemberListService;
//import com.gfxy.modules.honour.service.impl.DxryServiceImpl;
//import com.gfxy.modules.honour.service.impl.ZhrylServiceImpl;
//import com.gfxy.modules.teaching.entity.teachingresult.TeachingResult;
//import com.gfxy.modules.teaching.service.impl.AbstractProjectServiceImpl;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.jeecg.common.api.vo.Result;
//import org.jeecg.common.aspect.annotation.AutoLog;
//import org.jeecg.common.util.SpringContextHolder;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @author: lijixin 2021/10/30 11:33 上午
// */
//@Api(tags="教学建设公共API")
//@RestController
//@RequestMapping("/honour/honourCommon")
//@Slf4j
////  todo new
//public class HonourCommonController {
//
//    @Autowired
//    private IMemberListService memberListService;
//
//
//    @AutoLog(value = "教学建设公共API-获取成员积分")
//    @ApiOperation(value="教学建设公共API-获取成员积分", notes="教学建设公共API-获取成员积分")
//    @GetMapping(value = "/memberListScores")
//    public Result<?> getMemberListScores(
//            @RequestParam(name="projectType")  Integer projectType,
//            @RequestParam(name="totalScore")  Double totalScore,
//            @RequestParam(name="memeberNum") Integer memeberNum,
//            HttpServletRequest req) {
//        AbstractProjectServiceImpl abstractProjectService = getAbstractProjectService(projectType);
//        if(abstractProjectService == null){
//            return Result.error("错误的projectType:" + projectType);
//        } else {
//            Double[] result = abstractProjectService.getMemberListScore(totalScore,memeberNum);
//            JSONObject jsonObject = new JSONObject();
//            jsonObject.put("scores",result);
//            return Result.OK(jsonObject);
//        }
//
//
//    }
//
//
//    @AutoLog(value = "教学建设公共API-获取年度结果")
//    @ApiOperation(value="教学建设公共API-获取年度结果", notes="教学建设公共API-获取年度结果")
//    @GetMapping(value = "/honourProjectsResult")
//    public Result<?> getHonourProjectsResult(
//            @RequestParam(name="workNo") String workNo,
//            @RequestParam(name="date") String date){
//
//        List<MemberList> memberLists = memberListService.getMemberListByUserIdAndDate(workNo, date);
//        List<TeachingResult> teachingResults = new ArrayList<>();
//        for (MemberList memberList : memberLists) {
//            int projectType = memberList.getItemValue();
//            AbstractProjectServiceImpl abstractProjectService = getAbstractProjectService(projectType);
//            try{
//                // todo new 方法返回值应该添加荣誉奖励
//                TeachingResult teachingResult = abstractProjectService.getTeachingResultContent(memberList);
//                teachingResults.add(teachingResult);
//            } catch (Exception e){
//                e.printStackTrace();
//            }
//
//
//        }
//
//        return Result.OK(teachingResults);
//    }
//
////    @AutoLog(value = "教学建设公共API-获取年度结果")
////    @ApiOperation(value="教学建设公共API-获取年度结果", notes="教学建设公共API-获取年度结果")
////    @GetMapping(value = "/getTeacherBuildItemDetail")
////    public Result<?> getTeacherBuildItemDetail(@RequestParam(name="projectType") Integer projectType,@RequestParam(name="projectId") String projectId){
////        AbstractHonourProjectServiceImpl abstractProjectService = getAbstractProjectService(projectType);
////        Object gfxyBaseBean = abstractProjectService.getById(projectId);
////        return Result.OK(gfxyBaseBean);
////    }
//
//    public static AbstractProjectServiceImpl getAbstractProjectService(int projectType){
//        AbstractProjectServiceImpl abstractProjectService = null;
//        if(projectType == 1) {
//            abstractProjectService = SpringContextHolder.getBean(ZhrylServiceImpl.class);
//        } else if(projectType == 2) {
//            abstractProjectService = SpringContextHolder.getBean(DxryServiceImpl.class);
//        }
//
//        return abstractProjectService;
//    }
//}
